﻿using PetaPoco;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Cxuu.Models;

[TableName("cxuu_content_cate")]
[PrimaryKey("Id", AutoIncrement = true)]
public class ContentCate
{
    public int Id { get; set; }

    public int Pid { get; set; }

    public string Name { get; set; }

    public int Type { get; set; }

    public string Theme { get; set; }
    public string Ico { get; set; }
    public string Ctheme { get; set; }

    public int Sort { get; set; }

    public int Num { get; set; }

}

public class EditContentCate
{
    [Display(Name = "上级栏目")]
    public int Pid { get; set; }
    [Display(Name = "栏目名称")]
    public string Name { get; set; }
    [Display(Name = "栏目类型")]
    public int Type { get; set; }
    [Display(Name = "自定义模板")]
    public string Theme { get; set; }
    [Display(Name = "栏目图标")]
    public string Ico { get; set; }
    [Display(Name = "内容模板")]
    public string Ctheme { get; set; }
    [Display(Name = "排序")]
    [RegularExpression(RegxPatterns.Number, ErrorMessage = "{0}必须为数字")]
    public int Sort { get; set; } = 0;
    [Display(Name = "前台显示条数")]
    [RegularExpression(RegxPatterns.Number, ErrorMessage = "{0}必须为数字")]
    public int Num { get; set; } = 15;
}

public class ViewContentAndCate
{
    public int Id { get; set; }
    public int Cid { get; set; }
    public string Title { get; set; }
    public string Img { get; set; }
    public int Imgbl { get; set; }
    public string CateName { get; set; }
    public string Examine { get; set; }
    public string DeptName { get; set; }
    public string Nickname { get; set; }
    public DateTime Time { get; set; }
    public int Status { get; set; }
    public int AttA { get; set; }
    public int AttB { get; set; }
    public int AttC { get; set; }

}

public class ViewContentCate
{
    public int Id { get; set; }

    public int Pid { get; set; }

    public string Title { get; set; }
    public int Type { get; set; }

    public string Theme { get; set; }
    /// <summary>
    /// 栏目图标
    /// </summary>
    public string Ico { get; set; }
    /// <summary>
    /// 内容模板
    /// </summary>
    public string Ctheme { get; set; }
    public int Sort { get; set; }

    public int Num { get; set; }

    public int Depth { get; set; }
    /// <summary>
    /// 节点展开
    /// </summary>
    public string Spread { get; set; }
    /// <summary>
    /// 节点是否为禁用状态。默认 false
    /// </summary>
    public string Disabled { get; set; }

    public int ChildrenCount { get; set; }

    public bool HaveChild { get; set; }
    public bool Open { get; set; }
    public List<ViewContentCate> Children { set; get; } = new();


}